<extend name="Common@Layout:hui-admin" />
<block name="title"><title>应用私有用户-用户管理-Administator管理后台</title></block>
<block name="style">
</block>

<block name="main">
	<nav class="breadcrumb">
		<i class="Hui-iconfont"></i>
		 首页 <span class="c-gray en">&gt;</span>
		 用户管理 <span class="c-gray en">&gt;</span>  
		学生列表
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
	</nav>
	
	<div class="pd-20">
		<div class="text-c"> 
			<form status="{:u('index')}" method="get" id="form">
			<span class="select-box inline">
			<php>
				$searchtypes = array(
						'id'=>'用户ID',
						'student'=>'姓名',
						'jzxm'=>'家长姓名',
						'tel'=>'手机号'
					);
			</php>
			<select name="searchtype" class="select">
				<foreach name="searchtypes" item="vo">
					<option value="{$key}" <eq name="_GET['searchtype']" value="$key">selected</eq>>{$vo}</option>
				</foreach>
			</select>
			</span> 日期范围：
			<input type="text" name="start_time" value="{$_GET['start_time']}" class="input-text mini-time" style="width:120px;">
			-
			<input type="text" name="end_time" value="{$_GET['end_time']}" class="input-text mini-time" style="width:120px;">
			<input type="text" name="keywords" value="{$_GET['keywords']}" id="" placeholder="关键词" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont"></i> 搜索</button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20"> 
			<div class="btn-group l">
				<a href="{:U('index',array('status'=>0))}" class="btn btn-default <if condition='$_GET["status"] eq 0'>btn-primary</if> radius">全部</a>
			  	<a href="{:U('index',array('status'=>1))}" class="btn btn-default <if condition='$_GET["status"] eq 1'>btn-primary</if> radius">启用</a>
			  	<a href="{:U('index',array('status'=>2))}" class="btn btn-default <if condition='$_GET["status"] eq 2'>btn-primary</if> radius">禁用</a>
			</div>
			<span class="l ml-20"> 
				<a href="javascript:;" class="btn btn-danger radius ajax-post confirm" style="display:none" target-form="mini-form" data-msg="确定批量删除？" data-url="/ygcl/studentadmin/del.html"><i class="Hui-iconfont"></i> 批量删除</a> 
				<a class="btn btn-primary radius" href="javascript:;" onclick="open_iframe_dialog('{:U('edit')}','添加学生',['90%','90%'],1)"><i class="Hui-iconfont"></i> 添加学生</a>
				<a class="btn btn-primary radius" href="javascript:;" onclick="open_iframe_dialog('{:U('import')}','学生-批量导入',['700px','400px'],1)"><i class="Hui-iconfont"></i> 批量导入</a>  
			</span> 
		</div>
		<php>
			$xiaoqu = R('Apiadmin/getxiaoqurole');
			if($xiaoqu){
				$map['did'] = array('in',$xiaoqu);
			}
			$result = _get_list_data('/ygcl/studentadmin/index/',$_GET,$map,D('LessonStudentRelation'));
		</php>
		<form class="mini-form">
		<table class="table table-border table-bordered table-hover table-bg mini-sort">
			<thead>
				<tr>
					<th scope="col" colspan="12"><a class="btn btn-primary radius" href="{:U('export',$_GET)}">导出数据并生成excel</a> </th>
				</tr>
				<tr class="text-c">
					<th width="25"><input type="checkbox" value="" name=""></th>
					<th width="40">ID</th>
					<th>姓名</th>
					<th>手机</th>
					<th>家长姓名</th>
					<th>学期</th>	
					<th>校区</th>				
					<th>课程</th>
					<th>班级</th>
					<th>状态</th>
					<th>操作员</th>
					<th width="70">操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="result['data']['list']" item="vo">
				<tr class="text-c">
					<td><input type="checkbox" value="{$vo.id}" name="ids[]"></td>
					<td>{:replace_query_str($_GET['keywords'],$vo['id'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['student'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['tel'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['jzxm'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['term']['title'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['xiaoqu']['title'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['kecheng']['title'])}</td>
					<td>{:replace_query_str($_GET['keywords'],$vo['banji']['lessonname'])}</td>
					<td>
            			<if condition="$vo.status eq 1"><span class="c-green">启用</span><else/><span class="c-red">禁用</span></if>
					</td>
					<td>
						<php>
							$create_id = 0;
							$create_info = 0;
							$vo['record'][0]['uid']?$create_id = $vo['record'][0]['uid'] : $create_id = 0;
							if($create_id){
								$create_info = M('Users')->where('uid = '.$create_id)->field('username,realname')->find();
							}
						</php>
						<a style="text-decoration:none" class="ml-5" onclick="open_iframe_dialog('{:U('Recordadmin/sigle','lsid='.$vo['id'])}','操作记录-用户：{$vo[student]}',['90%','90%'],1)" href="javascript:;" title="操作记录"><if condition="$create_info['realname']">{$create_info['realname']}<else />{$create_info['username']}</if></a>
					</td>
					<td class="f-14">
						<if condition="$vo.status eq 1">
            			<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('changestatus','id='.$vo['id'].'&status=2')}" href="javascript:;" title="禁用"><i class="Hui-iconfont"></i></a>
            			<else/>
            			<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('changestatus','id='.$vo['id'].'&status=1')}" href="javascript:;" title="启用"><i class="Hui-iconfont"></i></a>
            			</if>
            			<a style="text-decoration:none" class="ml-5" onclick="open_iframe_dialog('{:U('edit','id='.$vo['id'])}','修改学生',['90%','90%'],1)" href="javascript:;" title="编辑"><i class="Hui-iconfont"></i></a>
            			<a style="text-decoration:none" class="ml-5 mini_del" data-url="{:U('del','ids='.$vo['id'])}" href="javascript:;" title="删除"><i class="Hui-iconfont"></i></a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		{$result['pagetpl']}
	</div>
</block>

<block name="script">
<script>
$('#changeG').change(function(){
	window.location.href="/admin/Users/app/appid/"+$('#changeG').val();
});
$(function(){
	$('.mini-time').datepicker();
});
</script>
</block>